#include<bits/stdc++.h>
using namespace std;
int main()
{
	int l,r,i,time=0,x;
	cin>>l>>r;
	for(i=l;i<=r;i++)
	{
		x=i;
		while(x)
		{
			if(x%10==2)
			{
				time++;
				x/=10;
			}
			else
			{
				x/=10;
			}
		}
	}
	cout<<time;
    return 0;
}

